package com.chilly.other.jvm;

import java.util.LinkedList;

/**
 * 常量池OOM
 * Created by Chilly Cui on 2020/12/21.
 */
public class RuntimePoolOOM {
    public static void main(String[] args) {
        int i = 1;
        //保持常量的引用，防止被fullgc收集
        LinkedList xttblog = new LinkedList();

        while (true) {
            //将常量添加到常量池
            xttblog.add(String.valueOf(i++).intern());
        }
    }
}
